﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebEntities.Models.Framework
{
    public class UIMenuItem
    {
        public int ItemID { get; set; }
        public string ItemName { get; set; }
        public int? MenuID { get; set; }
        public string MenuName { get; set; }
        public string ItemUrl { get; set; }
        public string MvcArea { get; set; }
        public string MvcCtrl { get; set; }
        public string MvcAction { get; set; }
        public int? ParentID { get; set; }
        public string ParentItemName { get; set; }
        public DateTime CreateTime { get; set; }
        public string Creator { get; set; }
        public int? SortNum { get; set; }

        public static UIMenuItem AsUIMenuItem(FW_MenuItem muItem, string menuName, string pitemName)
        {
            UIMenuItem uitem = new UIMenuItem
            {
                ItemID = muItem.ItemID,
                ItemName = muItem.ItemName,
                MenuID = muItem.MenuID,
                MenuName = menuName,
                ItemUrl = muItem.ItemUrl,
                MvcArea = muItem.MvcArea,
                MvcCtrl = muItem.MvcCtrl,
                MvcAction = muItem.MvcAction,
                ParentID = muItem.ParentID,
                ParentItemName = pitemName,
                CreateTime = muItem.CreateTime,
                Creator = muItem.Creator,
                SortNum = muItem.SortNum
            };
            return uitem;
        }
    }
}
